package ocean.chinacraft.common;

import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import ocean.chinacraft.common.constants.Constants;
import ocean.chinacraft.common.entity.fly.SkyLanternEntity;
import ocean.chinacraft.common.entity.projectile.FirecrackerEntity;

/**
 * 实体Type注册
 *
 * @author zhang
 * @since 2021/12/25
 */
public class ModEntityTypes {

    public static final DeferredRegister<EntityType<?>> ENTITY_TYPE = DeferredRegister.create(ForgeRegistries.ENTITIES,
            Constants.MOD_ID);

    /**
     * 鞭炮Type
     */
    public static final RegistryObject<EntityType<FirecrackerEntity>> FIRE_CRACKER = ENTITY_TYPE.register(
            "fire_cracker",
            () -> EntityType.Builder.<FirecrackerEntity>of(FirecrackerEntity::new,
                            EntityClassification.MISC).sized(0.5F, 0.5F)
                    .build(new ResourceLocation(Constants.MOD_ID, "fire_cracker").toString()));

    /**
     * 孔明灯Type
     */
    public static final RegistryObject<EntityType<SkyLanternEntity>> SKY_LANTERN = ENTITY_TYPE.register(
            "sky_lantern",
            () -> EntityType.Builder.of(SkyLanternEntity::new,
                            EntityClassification.MISC).sized(1F, 1F)
                    .build(new ResourceLocation(Constants.MOD_ID, "sky_lantern").toString()));

    public static void register(IEventBus bus) {
        ENTITY_TYPE.register(bus);
    }
}
